<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

/**
 * 二维码分组
 */
class CreateWxQrcodeGroup extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        //微信带参数二维码分组
        Schema::create('wx_qrcode_groups', function (Blueprint $table) {
            $table->increments('group_id')->comment('自增序号');
            $table->string('appid', 64)->default('')->comment('微信应用ID');
            $table->string('group_key', 10)->unique()->default('')->comment('分组键名');
            $table->string('group_name', 50)->default('')->comment('分组名称');
            $table->text('description')->comment('分组描述');
            $table->unsignedTinyInteger('is_forever')->default(0)->comment('是否为永久二维码(0:临时,1:永久)');
            $table->softDeletes();
            $table->timestamps();
            $table->index(['appid','group_id','deleted_at'], 'idx_1');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('wx_qrcode_groups');
    }
}
